<%@ page language="java" pageEncoding="UTF-8"%>
<%@page import="com.shsh.safemanage.dao.CommonDao"%>

<%
String theChooseType = request.getParameter("chooseType");
%>
<table width="750">
	<tr>
		<td>
			<input type="text" size="20" name="equipName" id="equipName" />
			<input type="button" value="点击筛选" 
				onclick="loadPageSection('equipment1_list.jsp', 'equipmentListSpan', {equipName:getElementValueByID('equipName'), pageNum:1, chooseType:<%=theChooseType%>})" />
			<%
			CommonDao commonDao = DaoCreator.createCommonDao();
			int totalRecordSize = commonDao.getTableRecordSize("equipment");
			int totalPage = totalRecordSize / 20;
			if (totalRecordSize % 20 != 0) {
				totalPage++;
			}
			
			for (int i = 0; i < totalPage; i++) {
			%>
			<a style="margin-left: 3px" href="#" 
				onclick="loadPageSection('equipment1_list.jsp', 'equipmentListSpan', {equipName:getElementValueByID('equipName'), pageNum:<%=i+1%>, chooseType:<%=theChooseType%>})"><%=i+1%></a>
			<%
			}
			%>
		</td>
	</tr>
	<tr>
		<td>
		<span id="equipmentListSpan">
		<%@include file="equipment1_list.jsp"%>
		</span>
		</td>
	</tr>
</table>

<script type="text/javascript">
function chooseMappingEquipment1(id, isManager) {
	$.dialog.get('equipListDialog').close();
	openWaitingDialog('waitingDialog');
	$.ajax({
		type:'post',
		url:'choose_equipment1_1_process.jsp',
		data:{
			id: id,
			isManager: isManager
		},
		success:function(data,state,xmlhttp){
			var obj = null;
			try {
				obj = eval('(' + data + ')');
			} catch (e) {
			}
			if (typeof(obj.isSuccess) != 'undefined') {
				if (obj.isSuccess == 'true') {
					loadPageSection('<%=request.getContextPath()%>/write_problem_depart_equip_section.jsp', 'chooseDepartEquipTD');
					loadPageSection('<%=request.getContextPath()%>/write_problem_informed_person.jsp', 'informPersonDiv');
				} else {
					$.dialog.alert(obj.error);
				}
				closeWaitingDialog('waitingDialog');
			}
		}
	});
}
</script>